Implement v1 show_history status compatibility - #245
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
There was a problem hiding this comment.
Pull request overview
Implements full v1-compatible get_status(show_history=...) behavior in the Azure Functions Durable provider by conditionally fetching Durable Task history and projecting it into the v1 historyEvents shape, while preserving the existing fast path when history isn’t requested or isn’t available.
Changes:
- Updated compatibility
get_status()to fetch history only whenshow_history=Trueand project it into v1historyEvents, honoringshow_inputandshow_history_output. - Extended
DurableOrchestrationStatusto round-triphistoryEvents(and accept legacyhistory) throughfrom_json()/to_json(). - Updated docs/changelog to remove the “ignored show_history flags” limitation and note the new support.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/azure-functions-durable/test_durable_orchestration_status_compat.py | Adds JSON round-trip tests for historyEvents and legacy history acceptance. |
| tests/azure-functions-durable/test_client_compat.py | Adds async tests validating history fetch gating, projection, and output/input suppression behavior. |
| azure-functions-durable/MIGRATION_GUIDE.md | Removes the prior limitation note about ignored show_history flags. |
| azure-functions-durable/CHANGELOG.md | Documents the new v1 get_status() history support and removes the known-limitation entry. |
| azure-functions-durable/azure/durable_functions/internal/compat/history_projection.py | Introduces the Durable Task → v1 historyEvents projection logic. |
| azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py | Adds history storage/serialization support to the status wrapper. |
| azure-functions-durable/azure/durable_functions/client.py | Wires show_history into get_status() with conditional history retrieval and projection. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
azure-functions-durable/azure/durable_functions/internal/compat/history_projection.py:101
TaskScheduledEventandSubOrchestrationInstanceCreatedEventare projected with aNamefield (from thenamedataclass field), while other projected events use the v1FunctionNamekey (e.g.,ExecutionStarted) and merged completion events also emitFunctionName. If an orchestration is still running and has scheduled-but-not-yet-completed work, these scheduled events will surface withName, which is inconsistent with the rest of the v1 history shape and makes consumers handle two keys for the same concept.
if isinstance(
event,
(history.TaskScheduledEvent,
history.SubOrchestrationInstanceCreatedEvent)):
item.pop("Version", None)
berndverst
left a comment
There was a problem hiding this comment.
One blocking v1 compatibility issue remains in failed activity and sub-orchestration history projection.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py:156
- The
historyproperty docstring says history is populated only whenshow_history=Trueis passed toget_status, butfrom_json()can also populate history whenhistoryEvents/ legacyhistoryis present. This makes the doc misleading for callers who reconstruct a status from JSON.
def history(self) -> Optional[list[Any]]:
"""Get the execution history.
The history is populated only when requested by passing
``show_history=True`` to the client's compatibility ``get_status`` API.
"""
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
CHANGELOG.md:45
- Wrapped changelog bullet lines should not be indented; this entry is inconsistent with other wrapped bullets in this file (e.g., the next item continues at column 1).
- Failed task and sub-orchestration history events now retain the host-provided
failure `reason` and redacted `details` alongside structured failure details.
azure-functions-durable/CHANGELOG.md:37
- Wrapped changelog bullet lines should not be indented; most wrapped bullets in this changelog continue at column 1 (for example, the next item’s continuation line starts with
header.).
- The v1-compatible `get_status()` API now supports `show_history` and
`show_history_output`, including compacted `historyEvents` output without an
additional history request when history is not requested.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a28a3fa8-303a-4a74-8fbc-8e062e39d97f
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py:156
- The
historyproperty docstring is now inaccurate: history can also be populated when reconstructing a status viafrom_json()(it readshistoryEvents/legacyhistory), not only viaget_status(show_history=True). This can mislead callers relying on JSON round-trips.
"""Get the execution history.
The history is populated only when requested by passing
``show_history=True`` to the client's compatibility ``get_status`` API.
"""
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
azure-functions-durable/azure/durable_functions/internal/compat/history_projection.py:145
- When compacting sub-orchestration events, the scheduled
SubOrchestrationInstanceCreatedEvententry is removed and itsinstance_idis not copied onto the corresponding *Completed/*Failed event. This dropsInstanceIdfrom the projected v1historyEvents, making sub-orchestration entries harder to correlate with child instances and diverging from the v1 history shape (which includes the child instance id on these events).
scheduled_index, scheduled_event = scheduled
item["ScheduledTime"] = _format_datetime(scheduled_event.timestamp)
item["FunctionName"] = scheduled_event.name
if show_input and scheduled_event.input is not None:
item["Input"] = scheduled_event.input
removed_indexes.add(scheduled_index)
berndverst
left a comment
There was a problem hiding this comment.
The unsafe failure-field synthesis has been removed, the shared gRPC protocol boundary is now explicitly documented and tested, and no actionable issues remain at this head.
Fixes #230
Summary
get_status(show_history=True)requests ithistoryEventsshapeshow_inputandshow_history_output, including current continued-as-new historyFailureDetails, but not the independent v1-onlyReasonandDetailsfieldsTesting
python -m pytest tests/azure-functions-durable -m "not dts and not azurite and not functions_e2e" -qpython -m flake8 azure-functions-durablepython -m flake8 tests/azure-functions-durablepython -m pyright azure-functions-durable/azure/durable_functions/internal/compat/durable_orchestration_status.py azure-functions-durable/azure/durable_functions/internal/compat/history_projection.pypython -m pymarkdown -c .pymarkdown.json scan azure-functions-durable/MIGRATION_GUIDE.md